home *** CD-ROM | disk | FTP | other *** search
/ USA Bestseller / USA BESTSELLER Vol 1-95 (Hepp-Computer)(1995).iso / e193 / 0150ter2._xe / PASCAL.EXE / STARTIME.PAS < prev    next >
Pascal/Delphi Source File  |  1993-09-10  |  1KB  |  46 lines

  1. {$M 4096,0,1024}
  2. { Terminate help file      }
  3. { Made 1993 by Bo Bendtsen }
  4.  
  5. Uses Dos,Crt;
  6. Var
  7.   Param    : String;
  8.   ph, pm   : Word;
  9.   h,m,s,hu : Word;
  10.   ch       : Char;
  11.  
  12. Function StrToInt(S: String) : LongInt;
  13. Var Kode,i : Integer;
  14. Begin
  15.   If Length(S) = 0 Then StrToInt := 0 Else Begin Val(S,i,Kode);
  16.     If Kode = 0 Then StrToInt := i Else StrToInt := 0; End;
  17. End;
  18.  
  19. Function IntToNulStr(i: LongInt;b:Byte): String;
  20. Var S : String[11];
  21. Begin
  22.   Str(i, S); While Length(S)<b Do S:='0'+S;
  23.   If Length(S)>b Then S:='?'+Copy(S,Length(S)-b+2,10); IntToNulStr:=S;
  24. End;
  25.  
  26. Begin
  27.   WriteLn(#13#10'Another Terminate utility');
  28.   If Paramcount<2 Then
  29.   Begin
  30.     WriteLn(#13#10#10'Start program at time. Syntax: STARTIME HH:MM Program parameters');
  31.     WriteLn('STARTIME 03:00 TERMINAT /BOSS:1');
  32.     Halt;
  33.   End;
  34.   Param:=ParamStr(1); ch:=#0;
  35.   ph:=StrToInt(Copy(Param,1,2)); pm:=StrToInt(Copy(Param,4,2));
  36.   Param:=''; For h:=2 to Paramcount Do Param:=Param+ParamStr(h)+' ';
  37.   WriteLn(#13#10#10'Starting: '+Param+' at time '+Paramstr(1));
  38.   Repeat
  39.     Gettime(h,m,s,hu);
  40.     Write(#13+IntToNulStr(h,2)+':'+IntToNulStr(m,2)+':'+IntToNulStr(s,2));
  41.     If KeyPressed Then Ch:=Readkey; Delay(250);
  42.   Until (ch=#$1B) or ((h=ph) and (m=pm));
  43.   If ch<>#$1B Then
  44.   Begin SwapVectors; Exec(GetEnv('COMSPEC'),' /C '+Param); SwapVectors; End;
  45. End.
  46.